<style type="text/css">
#orderActionDiv{margin-top:25px; padding:25px; /*border:1px solid #CCC;*/ text-align: right;}
#orderActionDiv a{display:inline-block; width:200px; padding:25px; text-align:center; color:#fff; background:#06f;}
#orderInfoDiv{width:898px; margin: 0 auto 25px; overflow: auto; padding:25px; border: 1px solid #ccc;}
#orderInfoDiv ul{margin-top:10px;}
#orderInfoDiv ul#orderSnUl{margin-top:0px;}
#orderInfoDiv li{display:inline-block; margin-right:10px; list-style:none; vertical-align: top; line-height:60px;}
#orderInfoDiv .receive_address{display:inline-block; width: 680px;}
a.action_button{padding:3px 5px; color:#fff; background:#06f;}
/*
#orderInfoDiv .receive_address li{display:inline-block; margin-bottom: 20px;}
*/

#orderGoodsDiv{width:950px; margin: 25px auto; overflow: auto;}
#orderGoodsDiv table{width:100%; text-align:left; clear:both;}
#orderGoodsDiv table th, #orderGoodsDiv table td{padding:12.5px; text-align:left; vertical-align:top;
	background:#f3f3f3;}
#orderGoodsDiv table td .goodThumbDiv{/* float:left; */ width:200px; height: 200px;}
#orderGoodsDiv table td .goodThumbDiv a{ width:200px; height: 200px;}
#orderGoodsDiv table td .goodThumbDiv a img{width:200px; height: 200px;}
#orderGoodsDiv table td .goodTitleAttrDiv{/* float:left; */ width:380px; /* height: 80px; */}
#orderGoodsDiv table td p.goodTitle{padding-top:12.5px;}
#orderGoodsDiv table td p.goodAttr{padding-top:12.5px; color:#999;}
#orderGoodsDiv table #orderTotalTd{text-align:right;}
#orderGoodsDiv table #orderTotalTd p{line-height: 20px;}
#orderGoodsDiv table #orderTotal{color:#F30;}

</style>

<div id="orderInfoDiv">
	<ul id="orderSnUl">
    	<li>订单编号：</li>
        <li><?php echo $view_data['order_info']['order_sn']; ?></li>
    </ul>
    <ul>
    	<li>订单状态：</li>
        <li id="orderStatus"><?php echo $view_data['order_info']['status_desc']; ?></li>
    </ul>
	<ul>
    	<li>下单时间：</li>
        <li><?php echo $view_data['order_info']['create_time_date_time']; ?></li>
    </ul>
	<ul>
    	<li>收货地址：</li>
		<li class="receive_address">
			<?php echo $view_data['order_info']['province_name']; ?> <?php echo $view_data['order_info']['city_name']; ?> <?php echo $view_data['order_info']['district_name']; ?> <?php echo $view_data['order_info']['street_name']; ?> <?php echo $view_data['order_info']['address']; ?>&nbsp;&nbsp;
			<?php echo $view_data['order_info']['receiver']; ?>&nbsp;&nbsp;
			<?php echo $view_data['order_info']['mobile']; ?>&nbsp;&nbsp;
			<?php echo $view_data['order_info']['tel']; ?>
		</li>
    </ul>
    <ul>
    	<li>配送方式：</li>
		<?php if( in_array($view_data['order_info']['status'], array(2,3)) ) : ?>
        <li><?php echo $view_data['order_info']['shipping_name']; ?></li>
		<li><?php echo $view_data['order_info']['shipping_sn']; ?></li>
		<li><a class="action_button" href="https://www.kuaidi100.com/chaxun?com=<?php echo $view_data['business_config']['shipping_code_look_up'][$view_data['order_info']['shipping_id']]; ?>&nu=<?php echo $view_data['order_info']['shipping_sn']; ?>" target="_blank">追踪快递</a></li>

		<?php else: ?>
		-
		<?php endif; ?>
    </ul>

	<?php if(!empty($view_data['order_info']['shipping_time'])) : ?>
		<ul>
			<li>发货时间：</li>
			<li><?php echo $view_data['order_info']['shipping_time_date_time']; ?></li>
		</ul>
	<?php endif ?>

	<?php if(!empty($view_data['order_info']['confirm_receive_time'])) : ?>
		<ul>
			<li>收货时间：</li>
			<li><?php echo $view_data['order_info']['confirm_receive_time_date_time']; ?></li>
		</ul>
	<?php endif ?>

	<?php if(!empty($view_data['order_info']['confirm_return_time'])) : ?>
		<ul>
			<li>退货时间：</li>
			<li><?php echo $view_data['order_info']['confirm_return_time_date_time']; ?></li>
		</ul>
	<?php endif ?>

</div>


<div id="orderGoodsDiv">
	<table>
    	<thead>
        	<tr>
            	<th>商品</th>
        		<th>价格</th>
            	<th>数量</th>
        		<th>小计</th>
            </tr>
        </thead>
        
        <tbody>
        	<?php foreach ($view_data['order_good_list'] as $item): ?>
        	<tr>
            	<td>
					<div class="goodThumbDiv">
						<a title="<?php echo $item['good_name']; ?>" target="_blank" href="<?php echo $this->get_url(array('route' => 'good_info', 'id' => $item['good_id']), true); ?>">
							<img class="goodThumb" height="80" width="80" alt="<?php echo $item['good_name']; ?>" src="<?php echo $item['good_thumb']; ?>">
						</a>
					</div>
					<div class="goodTitleAttrDiv">
						<p class="goodTitle"><a href="<?php echo $this->get_url(array('route' => 'good_info', 'id' => $item['good_id']), true); ?>" target="_blank" ><?php echo $item['good_name']; ?></a></p>
						<p class="goodAttr"><?php echo $item['spec_desc']; ?></p>
					</div>
                </td>
                <td><?php echo $item['good_price']; ?></td>
                <td><?php echo $item['good_number']; ?></td>
                <td><?php echo $item['item_total_price']; ?></td>
            </tr>
            <?php endforeach; ?>
            
            <tr>
            	<td id="orderTotalTd" colspan="4">
					<p>共 <span id="orderTotal">￥ <?php echo $view_data['order_info']['order_total_price']; ?></span></p>
				</td>
            </tr>
        </tbody>
    </table>
</div>


<?php if( ($view_data['order_info']['status'] == 0) || ($view_data['order_info']['status'] == 2) ): ?>
	<div id="orderActionDiv">
		<?php if($view_data['order_info']['status'] == 2): ?><p><a href="javascript:void(0);" onclick="confirmReceive();">确认收货</a></p><?php endif; ?>
	</div>
<?php endif; ?>

<script type="text/javascript">
function confirmReceive(){
	//if(confirm('请在收到货后才进行确认收货！确认收货？')){
	confirm_prompt_message('请在收到货后才进行确认收货！确认收货？', function(){
		var id = '<?php echo $view_data['order_info']['id']; ?>';

		$.ajax({
			type: 'POST',
			url: '<?php echo $this->get_url(array('route' => 'order_confirm_receive'), true); ?>',
			data: 'id=' + id,
			dataType: 'json',
			success: function(rdata){			
				if(rdata.status <= 0){
					//alert(rdata.message);
					show_prompt_message(rdata.message);
				}else{
					//alert(rdata.message);
					show_prompt_message(rdata.message);
					$('#orderStatus').html('已收货');
					$('#orderActionDiv').remove();
				}	
				
				return false;	
			}
		});
	//}
	});

	return false;
}
</script>